package com.example.roomdemo;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

/**
 * @author: tuyrt7 on 2020/9/4.
 */
@Dao
public interface StudentDao {

    @Insert
    void insert(Student student);

    @Delete
    void delete(Student student);

    @Update
    void update(Student student);

    @Query("select * from student where id = :id")
    Student getStudentById(int id);

    @Query("select * from student")
    LiveData<List<Student>> getAll();

}
